package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description CustomerOrdersController
 * @Author loe
 * @Date 2024-07-12
 */

@RestController
@Api(tags = "服务项接口")
@RequestMapping("/customer/orders")
public class CustomerOrdersController extends BaseController {
    @Autowired
    private NursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目列表
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/project/page")
    @ApiOperation(value = "分页查询护理项目列表")
    public ResponseResult<PageResponse<NursingProjectVo>> limitSearch(
            // @ApiParam(value = "护理项目名称") @RequestParam String name,
            @ApiParam(value = "每页显示数量") @RequestParam Integer pageNum,
            @ApiParam(value = "页数") @RequestParam Integer pageSize
            // @ApiParam(value = "状态") @RequestParam Integer status
    ) {
        PageResponse<NursingProjectVo> pageResponse = nursingProjectService.limitSearch(null, pageNum, pageSize, 1);
        return success(pageResponse);
    }

    @GetMapping("/project/{id}")
    @ApiOperation(value = "根据编号查询护理项目信息")
    public ResponseResult<NursingProjectVo> getById(
            @ApiParam(value = "主键id") @PathVariable Long id
    ) {
        NursingProjectVo nursingProjectVo = nursingProjectService.getById(id);
        return success(nursingProjectVo);
    }

}
